package com.aaa.controller.fpa;

import com.aaa.entity.LayData;
import com.aaa.entity.MyPage;
import com.aaa.entity.TFpaRecord;
import com.aaa.entity.fpa.TjMessage;
import com.aaa.service.fpa.TFpaRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * (TFpaRecord)表控制层
 *
 * @author yuyongli
 * @since 2022-10-25 15:46:19
 */
@RestController
@RequestMapping("tFpaRecord")
public class TFpaRecordController {
    /**
     * 服务对象
     */
    @Autowired
    private TFpaRecordService tFpaRecordService;


    /**
     * 查询所有的做题记录
     * @return
     */
    @GetMapping
    public LayData getData(MyPage myPage,TFpaRecord record){
        return new LayData(tFpaRecordService.getAll(myPage,record));
    }
    @GetMapping("{id}")
    public LayData getDetailData(@PathVariable Integer id, MyPage myPage){
        return new LayData(tFpaRecordService.getDetailMsg(myPage,id));
    }



    @GetMapping("checkrecord")
    public LayData checkUser(TFpaRecord record){
        return new LayData(tFpaRecordService.checkrecord(record));
    }

     @PostMapping("addrecord")
    public LayData addrecord(TFpaRecord record){

         return new LayData(tFpaRecordService.insertRecord(record));
    }

    @GetMapping("tj")
    public LayData getTongji(){

        return new LayData(tFpaRecordService.getTjData());
    }
    @GetMapping("tj2")
    public LayData getTongji2(MyPage myPage,TjMessage tjMessage){

        return new LayData(tFpaRecordService.getTjData2(myPage,tjMessage));
    }

}

